// 测试OK的
const Core = require('@alicloud/pop-core');
// https://help.aliyun.com/document_detail/57342.html
var client = new Core({
  accessKeyId: 'LTAIOL60W1RI80wB',
  accessKeySecret: 'IKH9qiA0Cl9Pg2YpjhMeIEAdWqltHi',
  endpoint: 'https://iot.cn-shanghai.aliyuncs.com',
  apiVersion: '2018-01-20'
});

var params = {
  "RegionId": "cn-hangzhou",
  "Items": "{PowerSwitch: 0}",
  "ProductKey": "a1Fm2LQJ6OY",
  "DeviceName": "raspberry"
}

var requestOption = {
  method: 'POST'
};

client.request('SetDeviceProperty', params, requestOption).then((result) => {
  console.log(JSON.stringify(result));
}, (ex) => {
  console.log('ex = ', ex);
})
